# @Time : 2020/12/10 11:14
# @Author: sl
# @File : user_query_native.py
import logging

from framework.api.AbstractApi import AbstractApi
from framework import db, app
from framework.util.InvertUtil import db_tuple_to_dict


# 原生sql 查询list对象 请求示例 http://127.0.0.1:8181/v2/userQueryNative
class UserQueryNative(AbstractApi):
    def handle_get_request(self):
        # resultproxy = db.session.execute("select id,name,create_time from user_sample ",params={}).fetchall()
        # """
        # resultproxy.fetchall()
        # resultProxy.fetchmany()
        # resultProxy.fetchone()
        # resultProxy.fetchone()
        # resultProxy.first()
        # """
        # for row in resultproxy:
        #     print(type(row),row.id, row.name,row.create_time)  #直接操作数据里的row
        # result1 = db_tuple_to_dict(resultproxy)
        # logging.debug("一种方式，用flask alchemy")
        # result2 = self.db.get_list("select * from user_sample ",args={})
        # logging.info("另一种方式不用转换"+str(result2))
        return "用于探测服务启动接口"
        # y=0
        # for x in range(1000):
        #     y=y+x
        # print("y::",y)
        # return y
